package com.rytx.web.controller.ysp;

import com.rytx.common.core.controller.BaseController;
import com.rytx.common.core.domain.AjaxResult;
import com.rytx.system.domain.ysp.ArtDiscountCycle;
import com.rytx.system.domain.ysp.ArtKdCompany;
import com.rytx.system.service.ArtDiscountCycleService;
import com.rytx.system.service.ISysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/discountcycle")
public class ArtDiscountCycleController extends BaseController {
    @Autowired
    private ArtDiscountCycleService artDiscountCycleService;

    /**
     * 获取租赁周期列表
     * @return
     */
    @GetMapping

    public AjaxResult getDiscountCycle(){
        return AjaxResult.success(artDiscountCycleService.getDiscountCycle()) ;
    }
    @PostMapping("/add")
    public AjaxResult addDiscountCycle(ArtDiscountCycle artDiscountCycle){
        artDiscountCycleService.addDiscountCycle(artDiscountCycle);
        return AjaxResult.success();
    }
    @PostMapping("/edit")
    public AjaxResult editDiscountCycle(ArtDiscountCycle artDiscountCycle){
        artDiscountCycleService.editDiscountCycle(artDiscountCycle);
        return AjaxResult.success();
    }
    @PostMapping("/delete")
    public AjaxResult deleteDiscountCycle(Long id){
        artDiscountCycleService.deleteDiscountCycle(id);
        return AjaxResult.success();
    }

}
